<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Using custom HTML</title>
</head>
<body>
<link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.2.0/styles/default.min.css">
<script src="https://unpkg.com/@highlightjs/cdn-assets@11.2.0/highlight.min.js"></script>

<script>
  //highlightAuto: (code: string, languageSubset?: string[]) => AutoHighlightResult
  const r = hljs.highlightAuto('<span>Hello World!</span>', ['js'])

  /*
    Highlighting with language detection. Accepts a string with the code to highlight and an optional array of language names and aliases restricting detection to only those languages. The subset can also be set with configure, but the local parameter overrides the option if set.

    突出显示语言检测。
    接受一个带有要突出显示的代码的字符串和一个可选的语言名称和别名数组，将检测仅限于这些语言。
    也可以使用 configure 设置子集，但如果设置，则本地参数会覆盖该选项。
  */

  console.log(r);
  /*
    language: detected language

    relevance: integer value representing the relevance score

    value: HTML string with highlighting markup

    secondBest: object with the same structure for second-best heuristically detected language (may be absent)
  */
</script>
</body>
</html>
